package com.guanyong.dao;

import com.guanyong.model.VideoTopLogModel;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * Created by mxk on 2017/5/26.
 * 视频购买日志
 *
 */
public interface IVideoTopLogDaoMapper {


    @Update("update t_ad_videotoplog set f_order=f_order-1 where f_id=#{id}")
    Integer up(@Param(value = "id") Integer id);
    @Update("update t_ad_videotoplog set f_order=f_order+1 where f_id=#{id}")
    Integer down(@Param(value = "id") Integer id);

    Integer insert(@Param(value = "record") VideoTopLogModel record);

    List<VideoTopLogModel> SelectVideoTopLogList(@Param("classType") Integer classType,
                                                 @Param("offset") Integer offset,
                                                 @Param("limit") Integer limit);

    Integer SelectVideoTopLogListCount(@Param("classType") Integer classType);

    VideoTopLogModel getByIdVideoTopLog(@Param("id")Integer id);

    VideoTopLogModel getByOrderVideoTopLog(@Param("order")Integer order,
                                           @Param("classType") Integer classType);

    @Select("select count(*) from t_ad_videotoplog")
    Integer getCount();

    @Select("select count(*) from t_ad_videotoplog where f_objectid=#{objectid}")
    Integer getobjectidCount(String objectid);


    @Delete("delete from  t_ad_videotoplog where f_id=#{id}")
    Integer del(Integer id);

    @Update("update t_ad_videotoplog set f_order=f_order-1 where f_order>#{order} and f_classtype=#{classType}")
    Integer ups(@Param(value = "order") Integer order,@Param(value = "classType") Integer classType);
}
